//FactTest.java
package _07recursion;

public class FactTest {
    private static int ret = 1;
    public static int fact(int n){
        // 递归终止条件
        if(n == 1)
            return 1;
        // 处理当前层逻辑
        // 下一层递归
        ret = n * fact(n - 1);

        return ret;
    }

    public static void main(String[] args) {
        System.out.println(fact(1));
        System.out.println(fact(2));
        System.out.println(fact(3));
        System.out.println(fact(4));
        System.out.println(fact(5));
        System.out.println(fact(6));
    }
}
